/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *                                                                         *
 *   AndroidWorld Library, Copyright 2011 Bryan Chadwick                   *
 *                                                                         *
 *   FILE: ./android/image/EmptyScene.java                                 *
 *                                                                         *
 *   This file is part of AndroidWorld.                                    *
 *                                                                         *
 *   AndroidWorld is free software: you can redistribute it and/or         *
 *   modify it under the terms of the GNU General Public License           *
 *   as published by the Free Software Foundation, either version          *
 *   3 of the License, or (at your option) any later version.              *
 *                                                                         *
 *   AndroidWorld is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with AndroidWorld.  If not, see <http://www.gnu.org/licenses/>. *
 *                                                                         *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

package android.image;

import android.graphics.Canvas;
import android.graphics.Paint;

/**
 * <style type='text/css'><!--
 *    .com{ font-style: italic; color: #880000; }
 *    .keyw{ font-weight: bold; color: #000088; }
 *    .num{ color: #00AA00; }
 *    .str{ color: #CC00AB; }
 *    .prim{ color: #0000FF; }
 *    img.example{ padding-left: 50px; padding-bottom: 30px; }
 *  --></style>
 * 
 * Represents the empty (blank) Scene (a cropped <code>Image</code>).
 * 
 * <pre>
 *    <span class='keyw'>new</span> EmptyScene(<span class='num'>160</span>, <span class='num'>90</span>)</pre>
 * <img class="example" src="test/images/empty-scene.png" />
 * <br />
 *
 */
public class EmptyScene extends Scene{
    protected int width;
    protected int height;
    protected Paint paint = Image.WHITE;
    protected boolean clipped;

    /** Construct an EmptyScene of (Width x Height) */
    public EmptyScene(double width, double height){
        this(round(width), round(height));
        
    }
    /** Construct an EmptyScene of (Width x Height) with the given
     *    background color. */
    public EmptyScene(double width, double height, String color){
        this(round(width), round(height), color);
    }
    /** Construct an EmptyScene of (Width x Height) */
    public EmptyScene(int width, int height){
        this(width, height, "white");
        this.clipped = true;
    }
    /** Construct an EmptyScene of (Width x Height) with the given
     *    background color. */
    public EmptyScene(int width, int height, String color){
        this.width = width;
        this.height = height;
        this.paint = Image.painter(Image.color(color), Image.SOLID);
        this.clipped = false;
    }
    /** Paint this Scene into the given graphics */
    public void paint(Canvas c, int x, int y){
        c.drawRect(x, y, width, height, this.paint);
        if(this.clipped){
            c.drawRect(x, y, width, height, Image.BLACK_OUTLINE);
            c.clipRect(x+1, y+1, width-1, height-1);
        }
    }
    
    protected int leftOfPin(){ return 0; }
    protected int rightOfPin(){ return width; }
    protected int upOfPin(){ return 0; }
    protected int downOfPin(){ return height; }
    
    /** Return the Width of this Scene/Image */
    public int width(){ return width; }
    
    /** Return the Width of this Scene/Image */
    public int height(){ return height; }
}

